using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace XXY
{
    class JsonUtil
    {
        #region 初始化
        public JsonUtil(string jsonStr)
        {
            this.jsonStr = jsonStr;
            Reduce();
            Init();
        }
        /// <summary>
        /// json 压缩
        /// </summary>
        private void Reduce()
        {
            string patternStr = "";
            #region ******************* 移除多行注释 ***************************
            // /\*[\s\S]*?\*/
            // 移除多行注释
            patternStr = "/\\*[\\s\\S]*?\\*/";
            jsonStr = Regex.Replace(jsonStr, patternStr, "");
            #endregion
            #region ******************* 移除空白字符 ***************************
            // "[\s\S]*?"
            // 匹配引号及其内容
            // \s
            // 匹配空白字符
            int start = 0;
            int end = 0;
            StringBuilder sb = new StringBuilder();
            patternStr = "\"[\\s\\S]*?\"";
            MatchCollection matchs = Regex.Matches(jsonStr, patternStr);
            foreach(Match match in matchs)
            {
                end = match.Index;
                sb.Append(Regex.Replace(jsonStr.Substring(start, end - start), "\\s",""));
                sb.Append(match.Value);
                start = end + match.Length;
            }
            end = jsonStr.Length;
            sb.Append(Regex.Replace(jsonStr.Substring(start, end - start), "\\s", ""));
            jsonStr = sb.ToString();
            #endregion
        }
        /// <summary>
        /// 解析Json
        /// </summary>
        private void Init() 
        {
            jsonObj = new JsonElement();
            jsonObj.rootTag = "";
            jsonObj.parentElement = null;
            parsingBody(jsonObj, jsonStr);
        }
        #endregion
        #region 属性
        private string jsonStr;
        public JsonElement jsonObj;
        #endregion
        #region Util
        private static void print(string msg)
        {
            Console.WriteLine(msg);
        }
        /// <summary>
        /// 将 jsonObj 转化成 字符串
        /// </summary>
        /// <returns></returns>
        public String toString() 
        {
            return JsonElementToString(jsonObj);
        }
        private String JsonElementToString(JsonElement jsonElement)
        {
            String _JsonStr = "{";
            int count = 0;

            #region 所有bool键值
            Dictionary<String, bool> boolmap = jsonElement.boolValue;
            foreach(var kv in boolmap)
            {
                _JsonStr += "\"" + kv.Key + "\":" + kv.Value.ToString().ToLower();
                if (++count != boolmap.Count)
                {
                    _JsonStr += ",";
                }
            }
            count = 0;
            #endregion
            #region 所有int键值
            Dictionary<String, int> intmap = jsonElement.intValue;
            if (intmap.Count > 0 && _JsonStr.Length > 6)
            {
                _JsonStr += ",";
            }
            foreach(var kv in intmap)
            {
                _JsonStr += "\"" + kv.Key + "\":" + kv.Value;
                if (++count != intmap.Count)
                {
                    _JsonStr += ",";
                }
            }
            count = 0;
            #endregion
            #region 所有浮点键值
            Dictionary<String, double> floatmap = jsonElement.doubleValue;
            if (floatmap.Count > 0 && _JsonStr.Length > 6)
            {
                _JsonStr += ",";
            }
            foreach(var kv in floatmap)
            {
                _JsonStr += "\"" + kv.Key + "\":" + kv.Value;
                if (++count != floatmap.Count)
                {
                    _JsonStr += ",";
                }
            } 
            count = 0;
            #endregion
            #region 所有字符串键值
            Dictionary<String, String> stringmap = jsonElement.stringValue;
            if (stringmap.Count > 0 && _JsonStr.Length > 6)
            {
                _JsonStr += ",";
            }
            foreach(var kv in stringmap)
            {
                _JsonStr += "\"" + kv.Key + "\":\"" + kv.Value + "\"";
                if (++count != stringmap.Count)
                {
                    _JsonStr += ",";
                }
            }
            count = 0;
            #endregion
            #region 所有JsonElement键值
            Dictionary<String, JsonElement> jsonElementmap = jsonElement.jsonValue;
            if (jsonElementmap.Count > 0 && _JsonStr.Length > 6)
            {
                _JsonStr += ",";
            }
            foreach(var kv in jsonElementmap)
            {
                _JsonStr += "\"" + kv.Key + "\":" + JsonElementToString(kv.Value);
                if (++count != jsonElementmap.Count)
                {
                    _JsonStr += ",";
                }
            }
            count = 0;
            #endregion

            #region 所有bool数组键值
            Dictionary<String, List<bool>> boolmaps = jsonElement.boolsValue;
            if (boolmaps.Count > 0 && _JsonStr.Length > 6)
            {
                _JsonStr += ",";
            }
            foreach(var kv in boolmaps)
            {
                List<bool> bools = kv.Value;
                String boolStr = "";
                for (int i = 0; i < bools.Count; i++)
                {
                    boolStr += bools[i].ToString().ToLower();
                    if (i < bools.Count - 1)
                    {
                        boolStr += ",";
                    }
                }
                _JsonStr += "\"" + kv.Key + "\":[" + boolStr + "]";
                if (++count != boolmaps.Count)
                {
                    _JsonStr += ",";
                }
            }
            count = 0;
            #endregion
            #region 所有int数组键值
            Dictionary<String, List<int>> intmaps = jsonElement.intsValue;
            if (intmaps.Count > 0 && _JsonStr.Length > 6)
            {
                _JsonStr += ",";
            }
            foreach(var kv in intmaps)
            {
                List<int> ints = kv.Value;
                String intStr = "";
                for (int i = 0; i < ints.Count; i++)
                {
                    intStr += ints[i];
                    if (i < ints.Count - 1)
                    {
                        intStr += ",";
                    }
                }
                _JsonStr += "\"" + kv.Key + "\":[" + intStr + "]";
                if (++count != intmaps.Count)
                {
                    _JsonStr += ",";
                }
            }
            count = 0;
            #endregion
            #region 所有浮点数组键值
            Dictionary<String, List<double>> floatmaps = jsonElement.doublesValue;
            if (floatmaps.Count > 0 && _JsonStr.Length > 6)
            {
                _JsonStr += ",";
            }
            foreach(var kv in floatmaps)
            {
                List<double> floats = kv.Value;
                String floatStr = "";
                for (int i = 0; i < floats.Count; i++)
                {
                    floatStr += floats[i];
                    if (i < floats.Count - 1)
                    {
                        floatStr += ",";
                    }
                }
                _JsonStr += "\"" + kv.Key + "\":[" + floatStr + "]";
                if (++count != floatmaps.Count)
                {
                    _JsonStr += ",";
                }
            }
            count = 0;
            #endregion
            #region 所有字符串数组键值
            Dictionary<String, List<String>> stringmaps = jsonElement.stringsValue;
            if (stringmaps.Count > 0 && _JsonStr.Length > 6)
            {
                _JsonStr += ",";
            }
            foreach(var kv in stringmaps)
            {
                List<String> strings = kv.Value;
                String stringStr = "";
                for (int i = 0; i < strings.Count; i++)
                {
                    stringStr += "\"" + strings[i] + "\"";
                    if (i < strings.Count - 1)
                    {
                        stringStr += ",";
                    }
                }
                _JsonStr += "\"" + kv.Key + "\":[" + stringStr + "]";
                if (++count != stringmaps.Count)
                {
                    _JsonStr += ",";
                }
            }
            count = 0;
            #endregion
            #region 所有JsonElement数组键值
            Dictionary<String, List<JsonElement>> jsonElementmaps = jsonElement.jsonsValue;
            if (jsonElementmaps.Count > 0 && _JsonStr.Length > 6)
            {
                _JsonStr += ",";
            }
            foreach(var kv in jsonElementmaps)
            {
                List<JsonElement> jsonElements = kv.Value;
                String jsonElementStr = "";
                for (int i = 0; i < jsonElements.Count; i++)
                {
                    jsonElementStr += JsonElementToString(jsonElements[i]);
                    if (i < jsonElements.Count - 1)
                    {
                        jsonElementStr += ",";
                    }
                }
                _JsonStr += "\"" + kv.Key + "\":[" + jsonElementStr + "]";
                if (++count != jsonElementmaps.Count)
                {
                    _JsonStr += ",";
                }
            }
            #endregion

            _JsonStr += "}";
            return _JsonStr;
        }
        #endregion
        #region 内部解析
        /// <summary>
        /// 返回所在位置的层级。1：表示顶级层级（根节点），2：表示二级层级；3：表示三级层级；以此类推......(具体问题具体分析)
        /// </summary>
        /// <param name="_JsonStr">json 格式字符串</param>
        /// <param name="pos">节点在_json 位置</param>
        /// <returns></returns>
        private int NodeHierarchyNum(string _JsonStr, int pos)
        {
            _JsonStr = _JsonStr.Substring(0, pos);
            int braceL = 0;   // 左括号数量
            int braceR = 0;   // 右括号数量
            #region ******************* 移除引号内容 ***************************
            // "[\s\S]*?"
            string patternStr = "\"[\\s\\S]*?\"";
            _JsonStr = Regex.Replace(_JsonStr, patternStr, "");
            #endregion
            #region ******************* 左右括号计数 ***************************
            patternStr = "\\{";
            MatchCollection matchs = Regex.Matches(_JsonStr, patternStr);
            braceL = matchs.Count;
            patternStr = "\\}";
            matchs = Regex.Matches(_JsonStr, patternStr);
            braceR = matchs.Count;
            #endregion
            return braceL - braceR;
        }
        #region 数组
        /// <summary>
        /// 获取 节点下的所有bool数组集合
        /// </summary>
        /// <param name="_JsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, List<bool>> getBoolMap(string _JsonStr)
        {
            // "([^,"\[\]\{\}]+?)":\[(true|,|false)+?](?=(,|}))
            // 匹配 "BoolAray":[true,true,false,true,true,true],
            // BoolAray true,true,false,true,true,true
            Dictionary<string, List<bool>> listHashMap = new Dictionary<string, List<bool>>();
            string patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":\\[(true|,|false)+?](?=(,|\\}))";
            MatchCollection matchs = Regex.Matches(_JsonStr, patternStr);
            foreach(Match matcher in matchs)
            {
                string mStr = matcher.Value;
                string tag = matcher.Groups[1].Value;
                if (NodeHierarchyNum(_JsonStr, matcher.Index) == 1&&!listHashMap.ContainsKey(tag))
                {
                    string body = mStr.Substring(4 + tag.Length, mStr.Length - 1-4-tag.Length);
                    List<bool> booleans = new List<bool>();
                    string[] strings = body.Split(',');
                    for (int i = 0; i < strings.Length; i++)
                    {
                        booleans.Add(bool.Parse(strings[i]));
                    }
                    listHashMap.Add(tag, booleans);
                }
            }
            return listHashMap;
        }
        /// <summary>
        /// 获取 节点下的所有整数数组集合
        /// </summary>
        /// <param name="_JsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, List<int>> getIntMap(string _JsonStr)
        {
            // "([^,"\[\]\{\}]+?)":\[(\d|,)+?](?=(,|}))
            // 匹配 "IntArray":[100,5,6,9,8,7,3,6,4,2]
            // IntArray 100,5,6,9,8,7,3,6,4,2
            Dictionary<string, List<int>> listHashMap = new Dictionary<string, List<int>>();
            string patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":\\[(\\d|,)+?](?=(,|\\}))";
            MatchCollection matchs = Regex.Matches(_JsonStr, patternStr);
            foreach(Match matcher in matchs)
            {
                string mStr = matcher.Value;
                string tag = matcher.Groups[1].Value;
                if (NodeHierarchyNum(_JsonStr, matcher.Index) == 1&&!listHashMap.ContainsKey(tag))
                {
                    string body = mStr.Substring(4 + tag.Length, mStr.Length - 1-4-tag.Length);
                    List<int> integers = new List<int>();
                    string[] strings = body.Split(',');
                    for (int i = 0; i < strings.Length; i++)
                    {
                        integers.Add(int.Parse(strings[i]));
                    }
                    listHashMap.Add(tag, integers);
                }
            }
            return listHashMap;
        }
        /// <summary>
        /// 获取 节点下的所有浮点数组集合
        /// </summary>
        /// <param name="_JsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, List<double>> getDoubleMap(String _JsonStr)
        {
            // "([^,"\[\]\{\}]+?)":\[(\d+?\.\d+?|,)+?](?=(,|}))
            // 匹配 "FloatArray":[0.1,0.2,0.6,0.6,0.8,0.8,10.65],
            // FloatArray 0.1,0.2,0.6,0.6,0.8,0.8,10.65
            Dictionary<string, List<double>> listHashMap = new Dictionary<string, List<double>>();
            String patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":\\[(\\d+?\\.\\d+?|,)+?](?=(,|\\}))";
            MatchCollection matchs = Regex.Matches(_JsonStr, patternStr);
            foreach(Match matcher in matchs)
            {
                String mStr = matcher.Value;
                String tag = matcher.Groups[1].Value;
                if (NodeHierarchyNum(_JsonStr, matcher.Index) == 1&&!listHashMap.ContainsKey(tag))
                {
                    String body = mStr.Substring(4 + tag.Length, mStr.Length - 1-4-tag.Length);
                    List<double> integers = new List<double>();
                    String[] strings = body.Split(',');
                    for (int i = 0; i < strings.Length; i++)
                    {
                        integers.Add(double.Parse(strings[i]));
                    }
                    listHashMap.Add(tag, integers);
                }
            }
            return listHashMap;
        }
        /// <summary>
        /// 获取 节点下的所有字符串数组集合
        /// </summary>
        /// <param name="_JsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, List<string>> getStringMap(String _JsonStr)
        {
            // "([^,"\[\]\{\}]+?)":\[("[\w\W]+?"|,)+?](?=(,|}))
            // 匹配 "StringArray":["1","fdasfasdfs","发大水发多少覆盖"]
            // StringArray "1","fdasfasdfs","发大水发多少覆盖"
            Dictionary<string, List<string>> listHashMap = new Dictionary<string, List<string>>();
            String patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":\\[(\"[\\w\\W]+?\"|,)+?](?=(,|\\}))";
            MatchCollection matchs = Regex.Matches(_JsonStr, patternStr);
            foreach(Match matcher in matchs)
            {
                String mStr = matcher.Value;
                String tag = matcher.Groups[1].Value;
                if (NodeHierarchyNum(_JsonStr, matcher.Index) == 1&&!listHashMap.ContainsKey(tag))
                { 
                    String body = mStr.Substring(5 + tag.Length, mStr.Length - 2-5-tag.Length);
                    List<String> integers = new List<string>();
                    String[] strings = Regex.Split(body, "\",\"");
                    for (int i = 0; i < strings.Length; i++)
                    {
                        integers.Add(strings[i]);
                    }
                    listHashMap.Add(tag, integers);
                }
            }
            return listHashMap;
        }
        /// <summary>
        /// 获取  Json对象数组
        /// </summary>
        /// <param name="_jsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, List<string>> getJsonArrays(String _jsonStr)
        {
            // "([^,"\[\]\{\}]+?)":\[{
            // 匹配对象开头
            // ](?=(,|}))
            // 匹配对象结束位置
            Dictionary<string, List<string>> listHashMap = new Dictionary<string, List<string>>();
            String patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":\\[\\{";
            MatchCollection matchers = Regex.Matches(_jsonStr, patternStr);
            foreach(Match matcher in matchers)
            {
                if (NodeHierarchyNum(_jsonStr, matcher.Index) == 1)//在第一层级也就是根节点的子节点
                {
                    String nextStr = _jsonStr.Substring(matcher.Index);
                    String ps = "\\](?=(,|\\}))";
                    Match m = Regex.Match(nextStr, ps);
                    while (m.Success)
                    {
                        String tag = matcher.Groups[1].Value;
                        if (NodeHierarchyNum(nextStr, m.Index + m.Length) == 0)
                        {
                            String body = nextStr.Substring(tag.Length + 4, m.Index + m.Length - 1 - 4 - tag.Length);
                            List<String> list = new List<string>();
                            String[] strings = Regex.Split(body, "(?<=\\}),(?=\\{)");
                            for (int i = 0; i < strings.Length; i++)
                            {
                                list.Add(strings[i]);
                            }
                            listHashMap.Add(tag, list);
                            //_jsonStr = _jsonStr.Substring(0, matcher.Index) + nextStr.Substring(m.Index + m.Length);
                            //matcher = Regex.Match(_jsonStr, patternStr);
                            break;
                        }
                    }
                }
            }
            return listHashMap;
        }
        #endregion
        #region 值
        /// <summary>
        ///  获取 节点下的所有bool类型的集合
        /// </summary>
        /// <param name="_JsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, bool> getBools(string _JsonStr)
        {
            // "([^,"\[\]\{\}]+?)":(true|false)(?=(,|}))
            // "Bool":false,
            // 匹配上面的 Bool false
            Dictionary<string, bool> hashMap = new Dictionary<string, bool>();
            string patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":(true|false)(?=(,|\\}))";
            MatchCollection matchs = Regex.Matches(_JsonStr, patternStr);
            foreach(Match matcher in matchs)
            {
                if (NodeHierarchyNum(_JsonStr,matcher.Index ) == 1&&!hashMap.ContainsKey(matcher.Groups[1].Value))
                {
                    hashMap.Add(matcher.Groups[1].Value, bool.Parse(matcher.Groups[2].Value));
                }
            }
            return hashMap;
        }
        /// <summary>
        /// 获取 节点下的所有整数类型的集合
        /// </summary>
        /// <param name="_JsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, int> getInts(string _JsonStr)
        {
            // "([^,"\[\]\{\}]+?)":([0-9]+)(?=(,|}))
            // "Int":11,
            // 匹配上面的 Int 11
            Dictionary<string, int> hashMap = new Dictionary<string, int>();
            string patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":([0-9]+)(?=(,|\\}))";
            MatchCollection matchs = Regex.Matches(_JsonStr, patternStr);
            foreach(Match matcher in matchs)
            {
                if (NodeHierarchyNum(_JsonStr, matcher.Index) == 1 && !hashMap.ContainsKey(matcher.Groups[1].Value))
                {
                    hashMap.Add(matcher.Groups[1].Value, int.Parse(matcher.Groups[2].Value));
                }
            }
            return hashMap;
        }
        /// <summary>
        /// 获取 节点下的所有浮点类型的集合
        /// </summary>
        /// <param name="_JsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, double> getDoubles(string _JsonStr)
        {
            // "([^,"\[\]\{\}]+?)":(\d+\.\d+)(?=(,|}))
            // "Float":"12656.501",
            // 匹配上面的 12656.501
            Dictionary<string, double> hashMap = new Dictionary<string, double>();
            string patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":(\\d+\\.\\d+)(?=(,|\\}))";
            MatchCollection matchs = Regex.Matches(_JsonStr, patternStr);
            foreach (Match matcher in matchs)
            {
                if (NodeHierarchyNum(_JsonStr, matcher.Index) == 1 && !hashMap.ContainsKey(matcher.Groups[1].Value))
                {
                    hashMap.Add(matcher.Groups[1].Value, double.Parse(matcher.Groups[2].Value));
                }
            }
            return hashMap;
        }
        /// <summary>
        /// 获取 节点下的所有字符串类型的集合
        /// </summary>
        /// <param name="_JsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, string> getStringss(string _JsonStr)
        {
            // "([^,"\[\]\{\}]+?)":"([\w\W]*?)"(?=(,|}))
            // "string":"小强",
            // 匹配上面的 string 小强
            Dictionary<string, string> hashMap = new Dictionary<string, string>();
            string patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":\"([\\w\\W]*?)\"(?=(,|\\}))";
            MatchCollection matchs = Regex.Matches(_JsonStr, patternStr);
            foreach (Match matcher in matchs)
            {
                if (NodeHierarchyNum(_JsonStr, matcher.Index) == 1 && !hashMap.ContainsKey(matcher.Groups[1].Value))
                {
                    hashMap.Add(matcher.Groups[1].Value, matcher.Groups[2].Value);
                }
            }
            return hashMap;
        }
        /// <summary>
        /// 获取  所有子节点对象
        /// </summary>
        /// <param name="_jsonStr"></param>
        /// <returns></returns>
        private Dictionary<string, string> getJsonObjs(string _jsonStr)
        {
            // "([^,"\[\]\{\}]+?)":{
            // 匹配对象开头
            // }(?=(,|}))
            // 匹配对象结束位置
            Dictionary<string, string> hashMap = new Dictionary<string, string>();
            string patternStr = "\"([^,\"\\[\\]\\{\\}]+?)\":\\{";
            MatchCollection matchers = Regex.Matches(_jsonStr, patternStr);
            foreach(Match matcher in matchers)
            {
                if (NodeHierarchyNum(_jsonStr, matcher.Index) == 1)//在第一层级也就是根节点的子节点
                {
                    string nextStr = _jsonStr.Substring(matcher.Index);
                    string ps = "\\}(?=(,|\\}))";
                    MatchCollection ms = Regex.Matches(nextStr, ps);
                    foreach (Match m in ms)
                    {
                        string tag = matcher.Groups[1].Value;
                        if (NodeHierarchyNum(nextStr, m.Index + m.Length) == 0 && !hashMap.ContainsKey(tag))
                        {
                            string body = nextStr.Substring(tag.Length + 3, m.Index + m.Length-3-tag.Length);
                            hashMap.Add(tag, body);
                            //_jsonStr = _jsonStr.Substring(0, matcher.Index) + nextStr.Substring(m.Index + m.Length);
                            break;
                        }
                    }
                }
            }
            return hashMap;
        }
        #endregion
        /// <summary>
        /// 解析json
        /// </summary>
        /// <param name="jsonElement"></param>
        /// <param name="_JsonStr"></param>
        /// <returns></returns>
        private JsonElement parsingBody(JsonElement jsonElement, String _JsonStr)
        {
            jsonElement.boolValue = getBools(_JsonStr);
            jsonElement.intValue = getInts(_JsonStr);
            jsonElement.doubleValue = getDoubles(_JsonStr);
            jsonElement.stringValue = getStringss(_JsonStr);
            jsonElement.jsonValue = new Dictionary<string, JsonElement>();
            Dictionary<String, String> hashMapObjs = getJsonObjs(_JsonStr);
            foreach(var keyValue in hashMapObjs)
            {
                JsonElement je = new JsonElement();
                je.rootTag = keyValue.Key;
                je.parentElement = jsonElement;
                jsonElement.jsonValue.Add(keyValue.Key, parsingBody(je, keyValue.Value));
            }


            jsonElement.boolsValue = getBoolMap(_JsonStr);
            jsonElement.intsValue = getIntMap(_JsonStr);
            jsonElement.doublesValue = getDoubleMap(_JsonStr);
            jsonElement.stringsValue = getStringMap(_JsonStr);
            jsonElement.jsonsValue = new Dictionary<string, List<JsonElement>>();
            Dictionary<String, List<String>> hashMapArrays = getJsonArrays(_JsonStr);
            foreach(var keyValueList in hashMapArrays)
            {
                List<JsonElement> listje = new List<JsonElement>();
                foreach(var _json in keyValueList.Value)
                {
                    JsonElement je = new JsonElement();
                    je.rootTag = keyValueList.Key;
                    je.parentElement = jsonElement;
                    listje.Add(parsingBody(je, _json));
                }
                jsonElement.jsonsValue.Add(keyValueList.Key, listje);
            }

            return jsonElement;
        }
        #endregion
        public class JsonElement
        {
            #region region 值类型 HashMap<键, 值>
            public Dictionary<string, string> stringValue;     // 字符串集合
            public Dictionary<string, int> intValue;       // 整数集合
            public Dictionary<string, double> doubleValue;       // 浮点集合
            public Dictionary<string, bool> boolValue;      // 开关集合
            public Dictionary<string, JsonElement> jsonValue;  // JsonElement 对象集合
            #endregion
            #region 数组类型 HashMap<键, List<类型>>   List<类型>：值
            public Dictionary<string, List<string>> stringsValue;    //字符串数组集合
            public Dictionary<string, List<int>> intsValue;      // 整数数组集合
            public Dictionary<string, List<double>> doublesValue;      // 浮点数组集合
            public Dictionary<string, List<bool>> boolsValue;     // 开关数组集合
            public Dictionary<string, List<JsonElement>> jsonsValue; // JsonElement对象数组集合
            #endregion

            #region 属性
            /// <summary>
            /// 元素根节点名称
            /// </summary>
            public string rootTag;
            /// <summary>
            /// 父节点
            /// </summary>
            public JsonElement parentElement;
            #endregion
        }
    }
}
